home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 67 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.4 KB

  1. From: David Byrden <100101.2547@compuserve.com>
  2. Message-ID: <4dknla$dap@news.bridge.net>
  3. X-Original-Date: 18 Jan 1996 06:00:10 GMT
  4. Path: in1.uu.net!bounce-back
  5. Date: 18 Jan 96 13:23:26 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Newsgroups: comp.std.c++
  8. Subject: Re: More on the operations on the entire container
  9. Organization: self-employed
  10. References: <AFyED_m0h3@qsar.chem.msu.su>
  11. X-Mailer: Mozilla 1.1N (Windows; I; 16bit)
  12. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  13.     iQBFAgUBMP5J3eEDnX0m9pzZAQE09QF+I1qXz5SCkf/IHqJroX4/Ub2d2wrb5WoX
  14.     eccoprOVv0xxOdvWtQu2bu8plq9dKPqm
  15.     =wMkc
  16.  
  17. Genie;
  18.  
  19. >> Operations on the whole container are (as the threads flashing here
  20. >> sometimes show) the most common kind of range operations in a program
  21. >> using the STL. Hence, it is generally felt that the current idiom for
  22. >> this    Iterator i = find(c.begin(), c.end(), x);  is verbose,
  23. >>  cumbersome and error-prone. 
  24.  
  25.  
  26. >>   So, what do you think?    
  27.  
  28. I think it's 6 months too late to propose changes to the standard!  :)
  29.  
  30. I keep a little library of template functions;
  31.  
  32.  
  33. template< class Container, class Functor > 
  34.  void  for_contents(  Container& c, Functor  f  )
  35.  {
  36.     for_each(  c.begin(), c.end(), f  ) ;
  37.  }
  38.  
  39.  
  40. Problem solved?
  41.  
  42.  
  43.              David
  44. ---
  45. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  46.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  47.   is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
  48.